package cn.edu.xmu.javaee.productwebflux.service;


import cn.edu.xmu.javaee.productwebflux.dao.ProductDao;
import cn.edu.xmu.javaee.productwebflux.dao.bo.Product;
import cn.edu.xmu.javaee.productwebflux.service.vo.ProductVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

@Slf4j
@RequiredArgsConstructor
@Service
public class ProductService {

    private final ProductDao productDao;

    public Mono<ProductVo> getDraft(Long shopId, Long draftId){
        return this.productDao.findById(shopId, draftId).map(draft -> ProductVo.builder().id(draft.getId()).name(draft.getName()).originalPrice(draft.getOriginalPrice()).originPlace(draft.getOriginPlace()).build());
    }



}
